""" import os
import subprocess
 
# 设置脚本所在目录为当前工作目录
script_dir = os.path.dirname(os.path.abspath(__file__))
print(script_dir)
os.chdir(script_dir)
 
# 执行脚本
subprocess.run(["python", "./tests/test.py"]) """

import os
import sys
import re
# 设置脚本所在目录为当前工作目录
script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(script_dir)

# from lib.tencent.translate import Translate

if __name__ == "__main__":
    """ t = Translate()
    print(t.trans("你好呀，小明")) """

    string = """
    Here is the prompt I came up with based on your theme:

<Prompt>
a beautiful young girl, standing alone on the beach, beautiful detailed eyes, beautiful detailed lips, extremely detailed eyes and face, long eyelashes, 1girl, golden hair, flowy white dress, blowing in the wind, ocean waves, seagulls flying, sunny day, clear blue sky, warm lighting, (best quality,4k,8k,highres,masterpiece:1.2), ultra-detailed, (realistic,photorealistic,photo-realistic:1.37), HDR, UHD, studio lighting, ultra-fine painting, sharp focus, physically-based rendering, extreme detail description, professional, vivid colors, bokeh, coastal scenery, serene atmosphere, (impressionism,watercolor:1.1)
</Prompt>

<NegativePrompt>
nsfw, (low quality,normal quality,worst quality,jpeg artifacts), cropped, monochrome, lowres, low saturation, ((watermark)), (white letters), skin spots, acnes, skin blemishes, age spot, mutated hands, mutated fingers, deformed, bad anatomy, disfigured, poorly drawn face, extra limb, ugly, poorly drawn hands, missing limb, floating limbs, disconnected limbs, out of focus, long neck, long body, extra fingers, fewer fingers, (multi nipples), bad hands, signature, username, bad feet, blurry, bad body
</NegativePrompt>

This prompt describes a beautiful young girl standing alone on the beach, with a focus on her detailed facial features and golden hair. The scene is set on a sunny day with ocean waves and seagulls flying in the background. The prompt also specifies a high level of detail and realism, with a focus on impressionism and watercolor styles. The negative prompt ensures that the generated image is of high quality and does not contain any unwanted features or distortions.
    """
    param = {"a": "b", "b": "c", "c": {"d":"1"}}
    for k in param:
        print(k, param[k])
        if k == 'c':
            c = param[k]
            c["d"] = 2
    print(param)
    pattern = r'<Prompt>(?P<prompt>[\s\S]*?)</Prompt>'  # 匹配一个或多个数字
    pattern = r'<NegativePrompt>(?P<prompt>[\s\S]*?)</NegativePrompt>'  # 匹配一个或多个数字
    a = re.search(pattern, string)
    if a:
        print(a.group('prompt'))
    
    
    
    

  
